package com.example.fist.entity;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;

@Entity
@Table(name = "school", schema = "competition", catalog = "")
public class SchoolEntity {
    private int shId;
    private String scName;
    private String address;
    private String phone;
    private int isvisible;
    private String note;
    private Date shTime;
    private Date modifiTime;
    private int zipCode;

    @Id
    @Column(name = "sh_id", nullable = false)
    public int getShId() {
        return shId;
    }

    public void setShId(int shId) {
        this.shId = shId;
    }

    @Basic
    @Column(name = "sc_name", nullable = false, length = 30)
    public String getScName() {
        return scName;
    }

    public void setScName(String scName) {
        this.scName = scName;
    }

    @Basic
    @Column(name = "address", nullable = false, length = 50)
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Basic
    @Column(name = "phone", nullable = false, length = 15)
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @Basic
    @Column(name = "isvisible", nullable = false)
    public int getIsvisible() {
        return isvisible;
    }

    public void setIsvisible(int isvisible) {
        this.isvisible = isvisible;
    }

    @Basic
    @Column(name = "note", nullable = false, length = -1)
    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    @Basic
    @Column(name = "sh_time", nullable = false)
    public Date getShTime() {
        return shTime;
    }

    public void setShTime(Date shTime) {
        this.shTime = shTime;
    }

    @Basic
    @Column(name = "modifi_time", nullable = false)
    public Date getModifiTime() {
        return modifiTime;
    }

    public void setModifiTime(Date modifiTime) {
        this.modifiTime = modifiTime;
    }

    @Basic
    @Column(name = "zip_code", nullable = false)
    public int getZipCode() {
        return zipCode;
    }

    public void setZipCode(int zipCode) {
        this.zipCode = zipCode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SchoolEntity that = (SchoolEntity) o;
        return shId == that.shId &&
                isvisible == that.isvisible &&
                zipCode == that.zipCode &&
                Objects.equals(scName, that.scName) &&
                Objects.equals(address, that.address) &&
                Objects.equals(phone, that.phone) &&
                Objects.equals(note, that.note) &&
                Objects.equals(shTime, that.shTime) &&
                Objects.equals(modifiTime, that.modifiTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(shId, scName, address, phone, isvisible, note, shTime, modifiTime, zipCode);
    }
}
